package com.ioidea.ble.bean

import java.nio.charset.StandardCharsets
import java.util.concurrent.TimeUnit

const val MAX_RETRY_COUNT=3
 class BleRequest(var sendDataArray: ByteArray= ByteArray(0),var callback: (bleResponse: BleResponse)->Unit={
}) {
     //每个指令单独设置超时时间
     val timeoutLong: Long? = null
     val timeoutUnit: TimeUnit? = null
     //一次发送应该回来 几条
     var count=0

     //消息发送失败重发
     var retryCount=0


     override fun toString(): String {
         return "BleRequest(sendDataArray=${String(sendDataArray,StandardCharsets.US_ASCII)})"
     }
 }

class BleResponse(var code: EnumResponse,var responseDataArray: ByteArray=ByteArray(0)){
     override fun toString(): String {
         return "BleResponse(code=$code, responseDataArray=${String(responseDataArray,StandardCharsets.US_ASCII)}})"
     }
 }
enum class EnumResponse {
    SUCCESS,WRITE_SUCC,WRITE_FAIL, ERROR, TIMEOUT
}
